|
|
|
|
|
|
|
Though you're going to use loadString only, it's good to go ahead and add the other methods supported for resource file operations. In the loadString method, include the following code: |
|
|
|
|
|
|
|
|
Public Function loadString(argIndex As Integer)
Dim locaIndex As Integer
locaIndex = argIndex
loadString = LoadResString(locaIndex)
locaIndex = 0
End Function |
|
|
|
|
|
|
|
|
Make the following declarations in the FormController class: |
|
|
|
|
|
|
|
|
Private theResourceFile As ResourceFile
Private Enum eResourceIds
bName = 0
bURL |
|
|
|
|
|
|
|
|
Modify the setForm method of the FormController class as follows: |
|
|
|
|
|
|
|
|
Public Sub showForm()
theBusiness.MyName = "John Conley"
Set theForm = New frmTest
'Instantiate the resource file class
Set theResourceFile = New ResourceFile
theForm.Label1(0).Caption = _
theResourceFile.loadString(eResourceIds.bName)
theForm.Label1(1).Caption = _
theResourceFile.loadString(eResourceIds.bURL)
theForm.Text1 = theBusiness.MyName
theForm.Show
End Sub |
|
|
|
|
|
|
|
|
That's it. If everything went okay, you have now successfully created a resource file class. Coincidentally, this ResourceFile class is part of the general File Operations Subsystem discussed on Day 17. |
|
|
|
|
|
|
|
|
This chapter covers many essential tactics for designing and implementing objects in the Graphical User Interface Subsystem. You learned modeling techniques for GUIs, the encapsulation of data presentation into a separate class and the classes in the subsystem. Finally, you became familiar with some ideas behind ergonomics and the internationalization with resource files. Tomorrow, you learn how to implement the Graphical User Interface Subsystem. |
|
|
|
|
|